package org.textreport.core;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class TextStyle {
	private Map<String, String> atts = new HashMap<String, String>();

	public String getType() {
		return atts.get("type");
	}

	public void set(String name, String value) {
		atts.put(name, value);
	}

	public String getAlign() {
		return atts.get("align");
	}

	public String getFill() {
		return atts.get("fill");
	}

	public int getSize() {
		String s = atts.get("size");

		return s == null ? 0 : Integer.valueOf(s);
	}

	public String getFromFormat() {
		return atts.get("from_format");
	}

	public String getToFormat() {
		return atts.get("to_format");
	}

	public String toString() {
		StringBuilder buf = new StringBuilder();
		for (Iterator<Map.Entry<String, String>> ite = atts.entrySet().iterator(); ite.hasNext();) {
			Map.Entry<String, String> entry = ite.next();
			buf.append(entry.getKey()).append(": ").append(entry.getValue()).append(";");
		}

		return buf.toString();
	}
}
